<template>
	<view>
		<!-- <view :class="isIpx ? 'fui-iphonex-button' : ''"></view> -->
		<!-- <loading v-if="!show"></loading> -->
		<view @tap="closeBtnFun" class="page-shade" v-if="show && closeBtn">></view>
		<view :class="'fui-share ' + (isIpx ? 'fui-iphonex-share' : '')" v-if="show && closeBtn">
			<view class="share-choose">
				<button openType="share" style="border: none;background:none;padding-left: 0;line-height: 1;margin: 0;">
					<view class="share-wechat">
						<image :src="imgUrl + 'plugin/app/static/images/wxapp/share/wechat.png'"></image>
						<view class="text-explain">分享给朋友</view>
					</view>
				</button>
				<view @tap="sharePoster" class="share-poster">
					<image :src="imgUrl + 'plugin/app/static/images/wxapp/share/post.png'"></image>
					<view class="text-explain">生成商品图片</view>
				</view>
				<view class="test-container" v-if="isgoods && goodscircle.can_share_goodscircle">
					<image :src="imgUrl + 'plugin/app/static/images/wxapp/share/goodscircle.png'"></image>
					<view class="text-explain">好物圈</view>
					<share-button @error="on_error" :product="goodscircle.share_goodscircle_product"></share-button>
				</view>
			</view>
			<view @tap="closeBtnFun" class="close-btn">关闭</view>
		</view>
		<view @tap="hintclick" class="hint" v-if="show && !limits">您还未授权无法查看商品完整信息，点击可重新获取授权喔~</view>
		<view class="page comment-block" v-if="show">
			<view class="goods-detail-goods" v-if="showgoods">
				<view v-if="usediypage != false">
					<view v-for="(diyitem, i) in diypages.items" :key="i">
						<tpl_fixedsearch v-if="diyitem.id == 'fixedsearch'" id="tplfixedsearch" :diyitem="diyitem"></tpl_fixedsearch>
						<tpl_banner @getMessage="navigate" v-if="diyitem.id == 'banner'" id="tplbanner" :diyitem="diyitem"></tpl_banner>
						<tpl_search v-if="diyitem.id == 'search'" id="tplsearch" :diyitem="diyitem"></tpl_search>
						<tpl_notice v-if="diyitem.id == 'notice'" id="tplnotice" :diyitem="diyitem"></tpl_notice>
						<tpl_line v-if="diyitem.id == 'line'" id="tplline" :diyitem="diyitem"></tpl_line>
						<tpl_blank v-if="diyitem.id == 'blank'" id="tplblank" :diyitem="diyitem"></tpl_blank>
						<tpl_title @gm="navigate" v-if="diyitem.id == 'title'" id="tpltitle" :diyitem="diyitem"></tpl_title>
						<tpl_menu @getMessage="navigate" v-if="diyitem.id == 'menu'" id="tplmenu" :diyitem="diyitem"></tpl_menu>
						<tpl_menu2 @getMessage="navigate" v-if="diyitem.id == 'menu2'" id="tplmenu2" :diyitem="diyitem"></tpl_menu2>
						<tpl_listmenu @getMessage="navigate" v-if="diyitem.id == 'listmenu'" id="tpllistmenu" :diyitem="diyitem"></tpl_listmenu>
						<tpl_picturew @getMessage="navigate" v-if="diyitem.id == 'picturew'" id="tplpicturew" :diyitem="diyitem"></tpl_picturew>
						<tpl_coupon @getMessage="navigate" v-if="diyitem.id == 'coupon'" id="tplcoupon" :diyitem="diyitem"></tpl_coupon>
						<tpl_goods @gm="selectPicker" v-if="diyitem.id == 'goods'" id="tplgoods" :diyitem="diyitem"></tpl_goods>
						<tpl_richtext v-if="diyitem.id == 'richtext'" id="tplrichtext" :diyitem="diyitem"></tpl_richtext>
						<tpl_video v-if="diyitem.id == 'video'" id="tplvideo" :diyitem="diyitem"></tpl_video>
						<tpl_copyright v-if="diyitem.id == 'copyright'" id="tplcopyright" :diyitem="diyitem"></tpl_copyright>
						<tpl_topmenu v-if="diyitem.id == 'topmenu'" id="tpltopmenu" :diyitem="diyitem"></tpl_topmenu>
						<tpl_tabbar @getMessage="tabwidget" v-if="diyitem.id == 'tabbar'" id="tpltabbar" :diyitem="diyitem"></tpl_tabbar>
						<tpl_seckillgroup v-if="diyitem.id == 'seckillgroup'" id="tplseckillgroup" :diyitem="diyitem" :min="min" :hour="hour" :sec="sec"></tpl_seckillgroup>
						<tpl_verifygoods v-if="diyitem.id == 'verifygoods'" id="tplverifygoods" :diyitem="diyitem"></tpl_verifygoods>
						<tpl_pictures v-if="diyitem.id == 'pictures'" id="tplpictures" :diyitem="diyitem"></tpl_pictures>
						<tpl_picture v-if="diyitem.id == 'picture'" id="tplpicture" :diyitem="diyitem"></tpl_picture>
						<tpl_icongroup v-if="diyitem.id == 'icongroup'" id="tplicongroup" :diyitem="diyitem"></tpl_icongroup>
						<tpl_audio v-if="diyitem.id == 'audio'" id="tplaudio" :diyitem="diyitem"></tpl_audio>
						<tpl_detail_swipe
							:interval="interval"
							:goods="goods"
							v-if="diyitem.id == 'detail_swipe'"
							id="tpldetail_swipe"
							:duration="duration"
							:showpic="showpic"
							:circular="circular"
							:advHeight="advHeight"
						></tpl_detail_swipe>
						<tpl_detail_info
							@gm="showshade"
							v-if="diyitem.id == 'detail_info'"
							id="tpldetail_info"
							:goods="goods"
							:diyitem="diyitem"
							:dispatchpriceObj="dispatchpriceObj"
							:preselltimeend="preselltimeend"
							:minprice="minprice"
							:maxprice="maxprice"
							:now="now"
						></tpl_detail_info>
						<tpl_detail_sale v-if="diyitem.id == 'detail_sale'" id="tpldetail_sale" :diyitem="diyitem"></tpl_detail_sale>
						<!-- 组件更新时间2020401 -->
						<!-- <tpl_detail_spec @gm="selectPicker" :isSelected="isSelected" :active="active" v-if="diyitem.id == 'detail_spec'" id="tpldetail_spec" :diyitem="diyitem" :goods="goods"></tpl_detail_spec> -->
						<tpl_package v-if="diyitem.id == 'detail_package'" id="tpldetail_package" :diyitem="diyitem" :goods="goods"></tpl_package>
						<tpl_detail_shop v-if="diyitem.id == 'detail_shop'" id="tpldetail_shop" :diyitem="diyitem" :goods="goods"></tpl_detail_shop>
						<tpl_detail_buy @gm="favorite" v-if="diyitem.id == 'detail_buy'" id="tpldetail_buy" :diyitem="diyitem" :goods="goods"></tpl_detail_buy>
						<tpl_detail_buyshow @gm="favorite" v-if="diyitem.id == 'detail_buyshow'" id="tpldetail_buyshow" :diyitem="diyitem" :goods="goods"></tpl_detail_buyshow>
						<tpl_detail_comment v-if="diyitem.id == 'detail_comment'" id="tpldetail_comment" :diyitem="diyitem" :goods="goods"></tpl_detail_comment>
						<tpl_detail_navbar
							@gm="selectPicker"
							@gmfavorite="favorite"
							:iphonexnavbar="iphonexnavbar"
							:goods="goods"
							v-if="diyitem.id == 'detail_navbar'"
							:limits="limits"
							:active="active"
							id="tpldetail_navbar"
							:diyitem="diyitem"
						></tpl_detail_navbar>
					</view>
				</view>
				<view v-if="usediypage == false">

					
					<view :style="'height:' + advHeight + 'rpx;position:relative;display:' + (showvideo ? 'block' : 'none')" v-if="goods.video">
						<view v-if="cover">
							<image class="bg" mode="aspectFit" :src="goods.thumb" style="height:100%;width:100%"></image>
							<image @tap="startplay" class="playFun" :src="play" style="width:150rpx;height:140rpx"></image>
							<view class="mc">
								<view @tap="showvideoFun" class="video_btn active">视频</view>
								<view @tap="showpicFun" class="pic_btn">图片</view>
							</view>
						</view>
						<!-- <video
							controls
							@fullscreenchange="bindfullscreenchange"
							@pause="bindpause"
							:class="'video ' + (showpic || cover ? 'none' : 'block')"
							id="myVideo"
							:muted="soundpic"
							showMuteBtn="true"
							:src="goods.video"
							:style="'width:100%;height:' + advHeight + 'rpx;'"
						>
							<cover-image @tap="changevoice" class="voice" :src="sound ? voice : mute"></cover-image>
							<cover-view class="mc" v-if="success">
								<cover-view @tap="showvideoFun" class="video_btn active">视频</cover-view>
								<cover-view @tap="showpicFun" class="pic_btn">图片</cover-view>
							</cover-view>
						</video> -->
						<video
							
						controls
						@fullscreenchange="bindfullscreenchange"
						:class="'video ' + (showpic || cover ? 'none' : 'block')"
						id="myVideo"
						:muted="soundpic"
						showMuteBtn="true"
						:src="goods.video"
						:style="'width:100%;height:' + advHeight + 'rpx;'"
						>
							<!-- <cover-image @tap="changevoice" class="voice" :src="sound ? voice : mute"></cover-image> -->
							<cover-view class="mc" v-if="success">
								<cover-view @tap="showvideoFun" class="video_btn active">视频</cover-view>
								<cover-view @tap="showpicFun" class="pic_btn">图片</cover-view>
							</cover-view>
						</video>
					</view>
					<view :class="'goods-advs ' + (showpic || goods.video == '' ? 'block' : 'none')" style="width:100%;height:auto;position:relative">
						<swiper
							:circular="circular"
							class="index-adcs-sqiper"
							:duration="duration"
							:indicatorDots="indicatorDots"
							:interval="interval"
							:style="'width:100%;height:' + advHeight + 'rpx;'"
						>
							<swiper-item v-for="(item, idx) in goods.thumbs" :key="idx">
								<image @load="idx == 0 ? 'imageLoad' : ''" class="goodsadvimg" :src="item"></image>
							</swiper-item>
						</swiper>
						<view class="mc">
							<view @tap="showvideoFun" class="video_btn" v-if="goods.video">视频</view>
							<view @tap="showpicFun" class="pic_btn active" v-if="goods.video">图片</view>
						</view>
					</view>
					<view class="seckill-container" v-if="goods.seckillinfo">
						<view class="fui-list seckill-list" style>
							<view class="fui-list-media seckill-price">
								¥
								<span>{{ goods.seckillinfo.price }}</span>
							</view>
							<view class="fui-list-inner">
								<view class="text">
									<span class="oldprice">{{ goods.marketprice }}</span>
								</view>
							</view>
						</view>
						<view class="fui-list seckill-list1">
							<view class="fui-list-inner">
								<view class="text">已出售 {{ goods.seckillinfo.percent }}%</view>
								<view class="text">
									<span class="process"><view class="process-inner" :style="'width: ' + goods.seckillinfo.percent + '%'"></view></span>
								</view>
							</view>
						</view>
						<view class="fui-list seckill-list2" style>
							<view class="fui-list-inner">
								<view class="text">{{ goods.seckillinfo.status == 1 ? '距开始' : '距结束' }}还有</view>
								<view class="text timer">
									<span class="time-hour">{{ hour }}</span>
									:
									<span class="time-min">{{ min }}</span>
									:
									<span class="time-sec">{{ sec }}</span>
								</view>
							</view>
						</view>
					</view>
					<view class="fui-cell-group fui-detail-group">
						<view class="fui-cell">
							<view class="fui-cell-text name">
								<text class="fui-tag fui-tag-danger" v-if="goods.ispresell == 1 && goods.ispresellshow == 1">预</text>
								<text class="cycle-tip" v-if="goods.type == 9">周期购</text>
								<text selectable="true">{{ goods.title }}</text>
							</view>
							<view @tap="showshade" class="fui-cell-remark showshade" style="margin-left: 60rpx;">
								<i class="icox icox-send" style="font-size:42rpx;color: #C7A457;"></i>
								<view style="font-size: 20rpx;color: #666;margin-top:-6rpx;">分享</view>
							</view>
						</view>
						<view class="fui-cell goods-subtitle" v-if="goods.subtitle">
							<text class="text-danger" selectable="true">{{ goods.subtitle }}</text>
	
						</view>
						<view class="fui-cell" v-if="!goods.seckillinfo">
							<view class="fui-cell-text price">
								<view :class=" 'text-danger ' + (goods.ispresell > 0 && preselltimeend > now ? goods.hasoption == 1 ? price.isTooLong([goods.minpresellprice, goods.maxpresellprice]) ? 'fz-28' : 'fz-36' : 'fz-36' : price.isTooLong([minprice, maxprice]) ? 'fz-28' : 'fz-36')">
									¥
									<block v-if="goods.ispresell > 0 && preselltimeend > now">
										<text v-if="goods.hasoption == 1">
											<text v-if="goods.minpresellprice != goods.maxpresellprice">{{ goods.minpresellprice }}~{{ goods.maxpresellprice }}</text>
											<text v-else>{{ goods.minpresellprice }}</text>
										</text>
										<text v-else>{{ goods.maxprice }}</text>
								
									</block>
									<block v-else>
										<block v-if="minprice == goods.maxprice">{{ minprice }}</block>
										<block v-else>{{ minprice }} ~ {{ maxprice }}</block>
									</block>
									
									<text class="original" v-if="goods.isdiscount != 0 && goods.isdiscount_time >= now">¥{{ goods.productprice }}</text>
									<block v-else>
										<text class="original" v-if="goods.productprice > goods.marketprice">¥{{ goods.productprice }}</text>
										
									</block>
									
									<text @tap="couponPicker" v-if="couponPrice!=0" class="jh">劵后 ¥{{couponPrice}}</text>
								</view>
							</view>
								
							<view class="detail-Commission flex" style="padding-bottom: 0;" v-if="goods.cansee > 0 && goods.seecommission > 0">
								<view class="text">{{ goods.seetitle }}</view>
								<view class="num flex1">￥{{ goods.seecommission }}</view>
								
							</view>
						</view>
					
						<view class="row row-time" v-if="goods.ispresell == 1 && goods.preselltimeend != 0 && goods.ispresellshow == 1">
							<view id="time-container">
								<text class="label">{{ goods.preselltitle ? goods.preselltitle : '距离预售开始' }}</text>
								<span class="number" :style="index == 0 ? 'margin-left:20rpx' : ''" v-for="(item, time_key) in time" :key="time_key">
									{{ item }}{{ index == 0 ? ' 天 ' : '' }}{{ index == 1 ? ' 时 ' : '' }}{{ index == 2 ? ' 分 ' : '' }}{{ index == 3 ? ' 秒 ' : '' }}
								</span>
							</view>
						</view>
						<view class="row row-time" id="discount" v-if="goods.isdiscount != 0 && goods.isdiscount_time >= now">
							<view id="discount-container">
								<text class="icox icox-shijian1"></text>
								<text class="label">{{ goods.isdiscount_title ? goods.isdiscount_title : '促销' }}</text>
								<block v-if="discountTitle">{{ discountTitle }}</block>
								<block v-else>
									<span class="number" :style="index == 0 ? 'margin-left:20rpx' : ''" v-for="(item, time_key) in time" :key="time_key">
										{{ item }}{{ index == 0 ? ' 天 ' : '' }}{{ index == 1 ? ' 时 ' : '' }}{{ index == 2 ? ' 分 ' : '' }}{{ index == 3 ? ' 秒 ' : '' }}
									</span>
								</block>
							</view>
						</view>
						<view class="row row-time" v-if="goods.istime > 0">
							<view id="time-container">
								<text class="icox icox-shijian1"></text>
								<text class="label">{{ istimeTitle ? istimeTitle : '限时购' }}</text>
								<block v-if="istime == 0">活动已结束</block>
								<block v-else>
									<span class="number" :style="index == 0 ? 'margin-left:20rpx' : ''" v-for="(item, time_key) in time" :key="time_key">
										{{ item }}{{ index == 0 ? ' 天 ' : '' }}{{ index == 1 ? ' 时 ' : '' }}{{ index == 2 ? ' 分 ' : '' }}{{ index == 3 ? ' 秒 ' : '' }}
									</span>
								</block>
							</view>
						</view>
						<tpl_international></tpl_international>
						<view class="fui-cell">
							<view class="fui-cell-text flex">
								<block v-if="dispatchpriceObj == 1">
									<text v-if="goods.type == 1">快递:{{ goods.dispatchprice.min }} ~ {{ goods.dispatchprice.max }}</text>
								</block>
								<block v-else>
									<text v-if="goods.isverify != 2">
										快递:
										<block v-if="goods.dispatchprice == 0">
											<block v-if="activity && activity.postfree && activity.postfree.goods">包邮</block>
											<block v-else>{{ goods.dispatchprice }}</block>
										</block>
										<block v-else>{{ goods.dispatchprice }}</block>
									</text>
								</block>
								<block v-if="!goods.seckillinfo || (goods.seckillinfo && goods.seckillinfo.status == 1)">
									<text v-if="goods.showtotal == 1">库存:{{ goods.total }}</text>
									<text v-if="goods.showsales == 1">销量:{{ goods.sales }}{{ goods.unit }}</text>
								</block>
								<text v-if="goods.province != '请选择省份' && goods.city != '请选择城市'">{{ goods.province }}{{ goods.city }}</text>
							</view>
						</view>
					</view>
					<view class="fui-cell-group fui-cell-click fui-sale-group" style="margin-top:0" v-if="goods.ispresell == 1 && (preselltimeend > now || preselltimeend == 0)">
						<view class="fui-list">
							<view class="fui-list-media">
								<view class="fui-cell-text"><span class="fui-label fui-label-safety">预售</span></view>
							</view>
							<view class="fui-list-inner" style="font-size:24upx;color:#666;">
								<view v-if="preselltimeend > 0">结束时间：{{ goods.preselldateend }}</view>
								预计发货：
								<block v-if="goods.presellsendtype > 0">购买后{{ goods.presellsendtime }}天发货</block>
								<block v-else>{{ goods.presellsendstatrttime }}</block>
							</view>
						</view>
					</view>
					<view class="favourable" v-if="!goods.seckillinfo">
						<view class="fui-cell-group fui-sale-group" style="margin-top:0" v-if="goods.buyagain > 0">
							<view class="fui-cell">
								<view class="fui-cell-text" style="white-space:normal;">
									此商品二次购买 可享受
									<span class="text-danger">{{ goods.buyagain }}</span>
									折优惠
									<view v-if="!goods.buyagain_sale">二次购买的时候 不与其他优惠共享</view>
								</view>
							</view>
						</view>
						<view @tap="couponPicker" class="fui-cell-group fui-cell-click fui-sale-group noborder" v-if="coupon.length > 0">
							<view class="fui-cell">
								<view class="fui-cell-text coupon-selector">
									<span style="margin-right: 0.25rem">优惠券</span>
									<span class="coupon-mini" v-if="index < 5" v-for="(item, coupon_key) in coupon" :key="coupon_key">
										<span class="subtitle" v-if="item.backpre">￥</span>
										{{ item.backmoney }}
										<span class="subtitle" v-if="item.backtype == 1">折</span>
									</span>
								</view>
								<view class="fui-cell-remark"><text v-if="coupon_l > 5">更多</text></view>
							</view>
						</view>
						<block v-if="limits">
							<block v-if="goods.isdiscount == 0 || (goods.isdiscount != 0 && goods.isdiscount_time < now)">
								<view class="fui-cell-group fui-sale-group" v-if="!goods.memberprice == '' && goods.memberprice != minprice && !goods.levelbuy == 0">
									<view class="fui-cell">
										<view class="fui-cell-label" style="color:#000;width:86rpx">会员</view>
										<view class="fui-cell-text">
											<view class="sale-line">
												<span class="sale-tip">{{ goods.memberprice.levelname }}</span>
												可享受
												<span class="text-danger">¥{{ goods.memberprice.price }}</span>
												的价格
											</view>
										</view>
									</view>
								</view>
							</block>
						</block>
						<block v-if="limits">
							<view @tap="giftPicker" class="fui-cell-group fui-sale-group" v-if="goods.isgift == 1">
								<view class="fui-cell">
									<view class="fui-cell-label" style="color:#000;width:98rpx">赠品</view>
									<view class="fui-cell-info" v-if="goods.gifts.length == 1">{{ goods.gifts[0].title }}</view>
									<view class="fui-cell-info" :style="gift_title ? '' : 'color:#666;'" v-else>{{ gift_title ? gift_title : '请选择赠品' }}</view>
									<view class="fui-cell-remark"></view>
								</view>
							</view>
						</block>
						<view @tap="activityPicker" class="fui-cell-group fui-sale-group" style="margin-top: 1rpx;" v-if="limits && activity && activity != ''">
							<view class="fui-cell">
								<view class="fui-cell-label" style="color:#000;width:86rpx">活动</view>
								<view class="fui-cell-text">
									<view class="sale-line" style="font-size: 24rpx;" v-if="activity.enough || activity.merch_enough">
										<span class="sale-tip">满减</span>
										<text v-if="activity.enough">全场满{{ activity.enough[0].enough }}立减{{ activity.enough[0].money }};</text>
										<text v-if="activity.merch_enough">本店满{{ activity.merch_enough[0].enough }}立减{{ activity.merch_enough[0].give }};</text>
									</view>
									<view class="sale-line" style="font-size: 24rpx;" v-if="fullbackgoods">
										<span class="sale-tip">{{ goods.fullbacktext }}</span>
										该商品享受
										<span class="text-danger" v-if="fullbackgoods.type == 0">¥{{ fullbackgoods.maxallfullbackallprice }}</span>
										<span class="text-danger" v-if="fullbackgoods.type == 1">{{ maxallfullbackallratio }}%</span>
										的{{ goods.fullbacktext }}
									</view>
									<view class="sale-line" style="font-size: 24rpx;" v-if="activity && activity.postfree">
										<span class="sale-tip">包邮</span>
										<span v-if="activity.postfree.goods">本商品包邮;</span>
										<text v-if="activity.postfree.scope">
											<text>{{ activity.postfree.scope }}</text>
											<text v-if="activity.postfree.enoughfree > 0">满￥{{ activity.postfree.enoughfree }}</text>
											<text>包邮</text>
										</text>
										<text v-if="activity.postfree.num">单品买{{ activity.postfree.num }}件包邮；</text>
										<text v-if="activity.postfree.price">单品买￥{{ activity.postfree.price }}包邮</text>
									</view>
									<view class="sale-line" style="font-size: 24rpx;" v-if="activity.buyagain">
										<span class="sale-tip">复购</span>
										此商品重复购买可享受 {{ activity.buyagain.discount }}折;
										<span v-if="activity.buyagain.buyagain_sale == 0">重复购买 不与其他优惠共享</span>
									</view>
									<view class="sale-line" style="font-size: 24rpx;" v-if="activity.credit">
										<span class="sale-tip">{{ credittext }}</span>
										<text v-if="activity.credit.deduct">最高抵扣￥{{ activity.credit.deduct }}；</text>
										<text v-if="activity.credit.give">购买赠送{{ activity.credit.give }}{{ credittext }}</text>
									</view>
								</view>
								<view class="fui-cell-remark"></view>
							</view>
						</view>
						<view @tap="sendclick" class="fui-cell-group fui-sale-group" style="margin-top: 1rpx;" v-if="goods.city_express_state">
							<view class="fui-cell">
								<view class="fui-cell-label" style="color:#000;width:86rpx">配送</view>
								<view class="fui-cell-label sale-line" style="flex: 1;font-size: 24rpx;">
									<span class="sale-tip">同城</span>
									查看商家位置
								</view>
								<view class="fui-cell-remark"></view>
							</view>
						</view>
					</view>
					<view
						@tap="cityPicker"
						class="fui-cell-group fui-cell-click  fui-sale-group"
						data-class="city-picker"
						:data-tap="active"
						id="city-picker"
						style="margin-top:0"
						v-if="goods.citys && goods.citys.citys && goods.citys.citys.length > 0 && goods.type != 5 && goods.isverify != 2"
					>
						<view class="fui-cell">
							<view class="fui-cell-text">
								{{ goods.citys.onlysent == 0 ? '不' : '只' }}配送区域:
								<block v-for="(item, idx) in goods.citys.citys" :key="idx">{{ item }}</block>
							</view>
							<view class="fui-cell-remark"></view>
						</view>
					</view>
					<view class="fui-cell-group fui-option-group" style="margin-top:0" v-if="goods.hasServices || goods.labelname">
						<view class="goods-label-demo">
							<view :class="'goods-label-list goods-label-style' + (labels.style + 1)" style="background:#fafafa">
								<span v-for="(item, label_key) in labels.list" :key="label_key">
									<icon type="" class="icox icox-duihao1" v-if="labels.style < 2"></icon>
									<text>{{ item }}</text>
								</span>
								<view style="clear: both;"></view>
							</view>
						</view>
					</view>
					<view
						@tap="selectPicker"
						class="fui-cell-group fui-cell-click"
						data-buytype="select"
						data-class="select-picker"
						:data-id="goods.id"
						:data-tap="active"
						v-if="goods.canbuy"
					>
						<view class="fui-cell" v-if="!isSelected">
							<view class="fui-cell-text option-selector">
								请选择
								<block v-if="goods.spec_titles">{{ goods.spec_titles }}等</block>
								<block v-else>数量</block>
							</view>
							<view class="fui-cell-remark"></view>
						</view>
						<view class="fui-cell" v-else>
							<view class="fui-cell-info">已选：数量x{{ total }} {{ specsTitle }}</view>
						</view>
					</view>
					<view class="fui-cell-group fui-cell-click" v-else>
						<view class="fui-cell">
							<view class="fui-cell-text">
								<block v-if="goods.userbuy == 0">您已经超出最大{{ goods.usermaxbuy }}件购买量</block>
								<block v-else-if="goods.levelbuy == 0">您当前会员等级没有购买权限</block>
								<block v-else-if="goods.groupbuy == 0">您所在的用户组没有购买权限</block>
								<block v-else-if="goods.timebuy == -1">未到开始抢购时间!</block>
								<block v-else-if="goods.timebuy == 1">抢购时间已经结束!</block>
								<block v-else-if="goods.total <= 0">商品已经售罄!</block>
							</view>
						</view>
					</view>
					<view class="fui-cell-group fui-comment-group" v-if="packagegoods">
						<navigator :url="'/pages/goods/package/index?id=' + packagegoodsid">
							<view class="fui-cell fui-cell-click">
								<view class="fui-cell-text desc">{{ packageList.title }}</view>
								<text class="fui-cell-text desc label" :url="'/pages/goods/package/index?id=' + packagegoodsid">更多套餐</text>
								<view class="fui-cell-remark"></view>
							</view>
						</navigator>
						<view id="package">
							<navigator
								hoverClass="none"
								id="package_list"
								:style="'width:' + (packageList.goods.length * 220 - 20) + 'rpx'"
								:url="'/pages/goods/package/detail/index?id=' + packageList.id"
							>
								<view class="package-goods package-goods3" v-for="(item, package_key) in packageList.goods" :key="package_key">
									<image class="package-goods-img" :src="item.thumb"></image>
									<p>{{ item.title }}</p>
									<text class="icox icox-tianjiazhuanhuan"></text>
								</view>
							</navigator>
						</view>
					</view>
					<view v-if="goods.shopdetail" class="fui-cell-group fui-shop-group">
						<navigator class="fui-list" openType="switchTab" url="/pages/index/index">
							<view class="fui-list-media"><image :src="goods.shopdetail.logo"></image></view>
							<view class="fui-list-inner">
								<view class="title">
									{{ goods.shopdetail.shopname }}
									<text class="title-wel">{{ goods.shopdetail.btntext2 }}</text>
								</view>
								<view class="subtitle" v-if="goods.shopdetail.description">{{ goods.shopdetail.description }}</view>
							</view>
						</navigator>
					</view>
					<view class="fui-cell-group" v-if="goods.buycontentshow > 0">
						<view class="fui-cell" style="display: block;"><jyf-parser :html="article_wxParseData_buycontent"></jyf-parser></view>
					</view>
				</view>

				<view class="fui-cell-group" v-if="(goods.params && goods.params.length > 0) || (goods.getComments && commentObj.list && commentObj.list.length > 0)">
					<view class="title">
						<view class="fui-tab fui-tab-danger" id="tab">
							<view @tap="goodsTab" :class="'item ' + info" data-tap="info">商品详情</view>
							<view @tap="goodsTab" :class="'item ' + para" data-tap="para" v-if="goods.params.length > 0">参数</view>
							<view @tap="goodsTab" :class="'item ' + comment" data-tap="comment" v-if="goods.getComments && commentObj.list && commentObj.list.length > 0">
								评价
							</view>
						</view>
					</view>
				</view>
				<view class="fui-cell-group" v-if="goods.params && goods.params.length == 0 && !(goods.getComments && commentObj.list && commentObj.list.length > 0)">
					<view class="fui-list"><view class="title">商品详情</view></view>
				</view>

				<view :class="'goods-detail-info ' + info" style="padding:0 8rpx;box-sizing: border-box;">
					<view class="wxParse" style="overflow: hidden;"><jyf-parser :html="article_wxParseData"></jyf-parser></view>
					<view class="bottom-image"><image mode="widthFix" :src="item" v-for="(item, img_key) in bottomFixedImageUrls" :key="img_key"></image></view>
				</view>
				<view :class="'goods-detail-comment ' + comment">
					<view class="fui-icon-group col-5">
						<view @tap="comentTap" class="fui-icon-col" data-level="item" :data-type="index + 1" v-for="(item, comment_key) in stararr" :key="comment_key">
							<view :class="commentObjTab == index + 1 ? 'text-danger' : ''">
								{{ index == 0 ? '全部' : '' }}{{ index == 1 ? '好评' : '' }}{{ index == 2 ? '中评' : '' }}{{ index == 3 ? '差评' : ''
								}}{{ index == 4 ? '晒图' : '' }}
								<view v-if="commentObj.count" :class="'count ' + (commentObjTab == index + 1 ? 'text-danger' : '')">{{ commentObj.count[item] }}</view>
							</view>
						</view>
					</view>
					<view class="fui-loading" v-if="loading">
						<view class="icon"></view>
						<view class="text">正在加载</view>
					</view>
					<view class="container" id="comments-all">
						<view class="fui-cell-group fui-comment-group">
							<view class="fui-cell" v-for="(item, idx) in commentList" :key="idx">
								<view class="fui-cell-text comment">
									<view class="info head">
										<view class="img"><image :src="item.headimgurl" style="width:50rpx;height:50rpx"></image></view>
										<view class="nickname">{{ item.nickname }}</view>
										<view class="date">{{ item.createtime }}</view>
										<view class="star star1"><text :class="item.level >= idx2 + 1 ? 'shine' : ''" v-for="(item2, idx2) in stararr" :key="idx2">★</text></view>
									</view>
									<view class="remark">{{ item.content }}</view>
									<view class="remark img">
										<view class="img" v-for="(image, idx) in item.images" :key="idx">
											<image @tap="preview" :data-src="image" :data-urls="item.images" mode="widthFix" :src="image"></image>
										</view>
									</view>
									<view class="reply-content" style="background:#EDEDED;" v-if="item.reply_content">
										掌柜回复：{{ item.reply_content }}
										<view class="remark img">
											<view class="img" v-for="(replyImage, idx) in item.reply_images" :key="idx"><image mode="widthFix" :src="replyImage"></image></view>
										</view>
									</view>
									<block v-if="item.append_content && item.replychecked == 0">
										<view class="remark reply-title">用户追加评价</view>
										<view class="remark">{{ item.append_content }}</view>
									</block>
									<view class="reply-content" style="background:#EDEDED;" v-if="item.append_reply_content">
										掌柜回复：{{ item.append_reply_content }}
										<view class="remark img">
											<view class="img" v-for="(appendReplyImage, idx) in item.append_reply_images" :key="idx"><image :src="appendReplyImage"></image></view>
										</view>
									</view>
								</view>
							</view>
						</view>
						<view class="fui-cell-group fui-comment-group"></view>
					</view>
					<view class="content-empty" :style="commentEmpty ? 'display:block' : 'display:none'">暂时没有任何评价</view>
				</view>
				<copyright :diyitem="copyright" v-if="copyright"></copyright>
				<view :class="'goods-detail-para ' + para">
					<view class="fui-cell-group">
						<view class="fui-cell" v-for="(item, idx) in goods.params" :key="idx">
							<view class="fui-cell-label">{{ item.title }}</view>
							<view class="fui-cell-info overflow">{{ item.value }}</view>
						</view>
					</view>
				</view>
				<view @tap="emptyActive" :class="'fui-mask ' + active"></view>
				<view :class="'fui-modal picker-modal ' + slider + ' ' + iphonexnavbar" v-if="tempname == 'city-picker'">
					<view class="city-picker">
						<view class="fui-cell-group fui-sale-group" style="margin-top:0;">
							<view class="fui-cell">
								<view class="fui-cell-text dispatching">
									不配送区域:
									<view class="dispatching-info">
										<i v-for="(item, idx) in goods.citys" :key="idx">{{ item }}</i>
									</view>
								</view>
							</view>
							<view @tap="emptyActive" class="btn btn-danger block">确定</view>
						</view>
					</view>
				</view>
				<goods-picker :id="id" ref="child" v-on:Selecthide="selecthide"></goods-picker>
			</view>
			<view style="position: fixed; bottom: 98rpx;left: 0;right: 0;z-index: 1001;">
				<date
					:iphonexnavbar="iphonexnavbar"
					@tap="doDay"
					:cycledate="cycledate"
					:currentDayList="currentDayList"
					:currentYear="currentYear"
					:currentMonth="currentMonth"
				></date>
			</view>
			<coupon-picker
				v-on:emptyActive="emptyActive"
				v-on:couponrecived="couponrecived"
				:iphonexnavbar="iphonexnavbar"
				:showcoupon="showcoupon"
				:coupon="coupon"
			></coupon-picker>
			<gift-picker :iphonexnavbar="iphonexnavbar" :gift="gift" :goods="goods"></gift-picker>
			<city-picker
				@gmonCancel="onCancel"
				@gmonConfirm="onConfirm"
				@gmbindChange="bindChange"
				:noArea="noArea"
				:iphonexnavbar="iphonexnavbar"
				:showPicker="showPicker"
				:areas="areas"
				:pval="pval"
			></city-picker>
			<act-picker
				v-if="activity"
				v-on:actOutPicker="actOutPicker"
				:iphonexnavbar="iphonexnavbar"
				:fadein="fadein"
				:activity="activity"
				:goods="goods"
				:credittext="credittext"
			></act-picker>
			<view class="empty_f"></view>
			<view :class="'fui-mask ' + (showPicker ? 'show' : '')" style="z-index: 1000"></view>
			<view :class="'fui-navbar bottom-buttons ' + iphonexnavbar" style="z-index: 1001" v-if="cycledate">
				<view @tap="syclecancle" class="nav-item btn cartbtn" data-buytype="cart" :data-tap="active" style="background: #ccc;">取消</view>
				<view @tap="sycleconfirm" class="nav-item btn buybtn" data-buytype="buy" :data-tap="active">确定</view>
			</view>
			<view v-if="usediypage == false">
				<view :class="'fui-navbar bottom-buttons ' + iphonexnavbar" v-if="goods.canbuy">
					<view @tap="favorite" class="nav-item favorite-item" v-if="!limits">
						<view :class="'icox ' + (goods.isfavorite ? 'icox-likefill' : 'icox-like')"></view>
						<view class="label">关注</view>
					</view>
					<view
						@tap="favorite"
						:class="'nav-item favorite-item ' + (goods.isfavorite ? 'active' : '')"
						:data-isfavorite="goods.isfavorite ? 1 : 0"
						v-if="goods.customer != 1 && limits"
					>
						<view :class="'icox ' + (goods.isfavorite ? 'icox-likefill' : 'icox-like')"></view>
						<view class="label">关注</view>
					</view>
					<button
						class="nav-item customer-item"
						openType="contact"
						:sendMessagePath="'/pages/goods/detail/index?id=' + goods.id"
						sessionFrom="weapp"
						showMessageCard="true"
						v-if="goods.customer == 1 && limits"
					>
						<view class="icox icox-customerservice"></view>
						<view class="label">客服</view>
					</button>
					<navigator class="nav-item external" openType="switchTab" :url="'/pages/index/index?merchid=' + goods.merchid">
						<view class="icox icox-shop1"></view>
						<view class="label">店铺</view>
					</navigator>
					<navigator class="nav-item cart-item" id="menucart" openType="switchTab" url="/pages/member/cart/index">
						<view :class="'badge ' + (goods.cartount <= 0 ? 'out' : 'in')" v-if="goods.cartcount && limits">{{ goods.cartcount }}</view>
						<view class="icox icox-cart1"></view>
						<view class="label">购物车</view>
					</navigator>
					<view @tap="selectPicker" class="nav-item btn cartbtn" data-buytype="cart" :data-id="goods.id" :data-tap="active" v-if="goods.canAddCart && goods.type != 9">
						加入购物车
					</view>
					<view @tap="selectPicker" class="nav-item btn buybtn" data-buytype="buy" :data-id="goods.id" :data-tap="active" v-if="!goods.access_time && !goods.timeout">
						立刻购买
					</view>
					<view
						@tap="selectPicker"
						class="nav-item btn buybtn"
						data-buytype="buy"
						:data-id="goods.id"
						:data-tap="active"
						data-time="access_time"
						data-timeout="false"
						v-if="goods.access_time"
					>
						立刻购买
					</view>
					<view
						@tap="selectPicker"
						class="nav-item btn buybtn"
						data-buytype="buy"
						:data-id="goods.id"
						:data-tap="active"
						data-time="timeout"
						data-timeout="false"
						v-if="goods.timeout"
					>
						立刻购买
					</view>
				</view>
			</view>
			<view :class="'fui-toast ' + (FoxUIToast.show ? 'in' : 'out')">
				<view class="text">{{ FoxUIToast.text }}</view>
			</view>
			<view class="nav-mask" :style="nav_mask2 ? 'display:block' : ''"></view>
			<view class="nav-model">
				<view :class="'nav-home ' + (nav_mask2 && navbar == 1 ? 'out2' : '') + ' ' + (nav_mask && navbar == 0 ? 'out' : '')">
					<span>商城首页</span>
					<navigator class="icox icox-homepage" openType="switchTab" url="/pages/index/index"></navigator>
				</view>
				<view :class="'nav-member ' + (nav_mask2 && navbar == 1 ? 'out2' : '') + ' ' + (nav_mask && navbar == 0 ? 'out' : '')" v-if="limits">
					<span>个人中心</span>
					<navigator class="icox icox-people" openType="switchTab" url="/pages/member/index/index"></navigator>
				</view>
				<view
					@tap="favorite"
					:class="'nav-collect ' + (nav_mask2 && navbar == 1 ? 'out2' : '') + ' ' + (nav_mask && navbar == 0 ? 'out' : '')"
					:data-isfavorite="goods.isfavorite ? 1 : 0"
					v-if="limits && goods.customer == 1"
				>
					<span>关注商品</span>
					<navigator :class="'icox ' + (goods.isfavorite ? 'icox-collection_fill' : 'icox-collection')"></navigator>
				</view>
				<view @tap="navFun" :class="'nav ' + (nav_mask ? 'icox icox-close' : '')" v-if="navbar == 0">
					<text v-if="!nav_mask">快捷</text>
					<text v-if="!nav_mask">导航</text>
				</view>
				<view @tap="nav2" :class="'nav nav2 ' + (nav_mask2 ? 'icox icox-close' : '')" v-if="navbar == 1">
					<text v-if="!nav_mask2">快捷</text>
					<text v-if="!nav_mask2">导航</text>
				</view>
			</view>
			<view class="model" v-if="modelShow">
				<view class="inner1">
					<view class="title">用户未授权</view>
					<view class="image"><image :src="imgUrl + 'plugin/app/static/images/wxapp/shouquan.png'"></image></view>
					<view class="subtitle">您需要先开启【用户信息】，才能使用此功能哦~</view>
					<view class="model-btns">
						<view @tap="cancelclick" class="cancel">取消</view>
						<view @tap="confirmclick" class="confirm">去设置</view>
					</view>
				</view>
			</view>
			<view @tap="phone" class="phone" v-if="!nav_mask && !nav_mask2 && goods.phone"><text class="icox icox-call"></text></view>
		</view>
		<view class="goods-layer" v-if="goods_hint_show">
			<view class="inner">
				<view class="goods-content">
					<view class="goods-title">温馨提示</view>
					<view class="goods-con">{{ goods.hint }}</view>
				</view>
				<view
					@tap="selectPicker"
					class="goods-btn buybtn"
					data-buytype="buy"
					:data-id="goods.id"
					:data-tap="active"
					data-time="access_time"
					data-timeout="true"
					v-if="goods.access_time"
				>
					确定
				</view>
				<view
					@tap="selectPicker"
					class="goods-btn buybtn"
					data-buytype="buy"
					:data-id="goods.id"
					:data-tap="active"
					data-time="timeout"
					data-timeout="true"
					v-if="goods.timeout"
				>
					确定
				</view>
				<view
					@tap="selectPicker"
					class="goods-btn buybtn"
					data-buytype="buy"
					:data-id="goods.id"
					:data-tap="active"
					:data-time="goods.access_time ? access_time : ''"
					data-timeout="true"
					v-if="!goods.access_time && !goods.timeout"
				>
					确定
				</view>
			</view>
		</view>
	</view>
</template>

<script module="price" lang="wxs" src="../../../utils/price.wxs"></script>
<script>
var t = getApp().globalData,
	e = t.requirejs('core'),
	a = (t.requirejs('icons'), t.requirejs('foxui')),
	o = t.requirejs('biz/diypage'),
	i = t.requirejs('biz/diyform'),
	s = t.requirejs('biz/goodspicker'),
	n = t.requirejs('jquery'),
	r = t.requirejs('wxParse/wxParse'),
	c = 0,
	d = t.requirejs('biz/selectdate');

export default {
	data() {
		return {
			diypages: { page: { background: '#fff' } },
			usediypage: !1,
			specs: [],
			options: [],
			icons: t.requirejs('icons'),
			goods: { ispresell: '' },
			indicatorDots: !0,
			autoplay: !0,
			interval: 5e3,
			duration: 500,
			circular: !0,
			play: '/static/images/video_play.png',
			mute: '/static/images/icon/mute.png',
			voice: '/static/images/icon/voice.png',
			active: '',
			slider: '',
			tempname: '',
			info: 'active',
			preselltimeend: '',
			presellsendstatrttime: '',
			advWidth: 0,
			dispatchpriceObj: 0,
			now: parseInt(Date.now() / 1e3),
			day: 0,
			hour: 0,
			minute: 0,
			second: 0,
			timer: 0,
			discountTitle: '',
			istime: 1,
			istimeTitle: '',
			isSelected: !1,
			params: {},
			total: 1,
			optionid: 0,
			audios: {},
			audiosObj: {},
			defaults: {
				id: 0,
				merchid: 0
			},
			buyType: '',
			pickerOption: {},
			specsData: [],
			specsTitle: '',
			canBuy: '',
			showPicker: !1,
			showcoupon: !1,
			pvalOld: [0, 0, 0],
			pval: [0, 0, 0],
			areas: [],
			noArea: !0,
			commentObj: {},
			commentObjTab: 1,
			loading: !1,
			commentEmpty: !1,
			commentPage: 1,
			commentTotal: 1,
			commentLevel: 'all',
			commentList: [],
			closeBtn: !1,
			soundpic: !0,
			animationData: {},
			uid: '',
			stararr: ['all', 'good', 'normal', 'bad', 'pic'],
			nav_mask: !1,
			nav_mask2: !1,
			nav: 0,
			giftid: '',
			limits: !0,
			modelShow: !1,
			showgoods: !0,
			timer: 0,
			lasttime: 0,
			hour: '-',
			min: '-',
			sec: '-',
			currentDate: '',
			dayList: '',
			currentDayList: {},
			currentObj: '',
			currentDay: '',
			checkedDate: '',
			showDate: '',
			scope: '',
			goods_hint_show: !1,
			presellisstart: 0,
			advHeight: 750,
			show_goods: !0,
			goodscircle: {
				can_share_goodscircle: !1
			},
			para: '',
			comment: '',
			show: '',
			coupon: [],
			coupon_l: '',
			packagegoods: '',
			packagegoodsid: '',
			credittext: '',
			activity: '',
			bottomFixedImageUrls: '',
			phonenumber: '',
			minprice: '',
			maxprice: '',
			style: '',
			navbar: '',
			labels: '',
			fullbackgoods: '',
			maxfullbackratio: '',
			maxallfullbackallratio: '',
			time: '',
			gift: !1,
			cycledate: '',
			imgUrl: '',
			copyright: '',
			id: '',
			windowWidth: '',
			windowHeight: '',
			success: '',
			cover: '',
			showvideo: '',
			currentYear: '',
			currentMonth: '',
			initDate: '',
			maxday: '',
			packageList: '',
			isgoods: '',
			isIpx: 0,
			iphonexnavbar: '',
			showpic: '',
			sound: '',
			gift_title: '',
			fadein: '',
			show: 1,
			index: 0,
			article_wxParseData: '',
			pagepicker: '',
			minpicker: '',
			wxParseData: '',
			goodsdetail: {},
			diyform: {
				fields: [],
				f_data: []
			},
			modeltakeout: '',
			canbuy: 0,
			stock: 0,
			FoxUIToast: {
				show: 0,
				text: ''
			},
			optionCommission: '',
			//最低优惠数据
			couponPrice:0,
			videoContext:Object,
		};
	},

	// components: { tpl, jyfparser, date, copyright,goodsparser },
	onReachBottom: function() {
		var t = this;

		if (t.commentTotal <= 10) return !1;
		var a = t.commentObjTab,
			o = '';
		1 == a ? (o = 'all') : 2 == a ? (o = 'good') : 3 == a ? (o = 'normal') : 4 == a ? (o = 'bad') : 5 == a && (o = 'pic'),
			t.setData({
				loading: !0
			}),
			e.get(
				'goods/get_comment_list',
				{
					id: t.options.id,
					level: o,
					page: t.commentPage
				},
				function(e) {
					0 == e.error &&
						(t.setData({
							loading: !1
						}),
						e.list.length > 0 &&
							t.setData({
								commentPage: t.commentPage + 1,
								commentTotal: e.total,
								commentList: t.commentList.concat(e.list)
							}));
				}
			);
	},
	onLoad: function(a) {
		t.checkAuth();
		var i = this;
		i.setData({
			imgUrl: t.globalData.approot
		}),
			e.get('black', {}, function(t) {
				t.isblack &&
					uni.showModal({
						title: '无法访问',
						content: '您在商城的黑名单中，无权访问！',
						success: function(t) {
							t.confirm && this.close(), t.cancel && this.close();
						}
					});
			}),
			o.get(this, 'goodsdetail', function(t) {
				var e = t.diypage.items;

				for (var a in e)
					'copyright' == e[a].id &&
						i.setData({
							copyright: e[a]
						});
			}),
			(a = a || {});
		var s = decodeURIComponent(a.scene);

		if (!a.id && s) {
			var n = e.str2Obj(s);
			(a.id = n.id), n.mid && (a.mid = n.mid);
		}

		this.setData({
			id: a.id
		}),
			t.url(a),
			uni.getSystemInfo({
				success: function(t) {
					i.setData({
						windowWidth: t.windowWidth,
						windowHeight: t.windowHeight
					});
				}
			});

		i.getDetail(a);
		i.setData({
			uid: a.id,
			options: a,
			success: !0,
			cover: !0,
			showvideo: !0
		}),
			uni.getSystemInfo({
				success: function(t) {
					i.setData({
						advWidth: t.windowWidth
					});
				}
			});

		setTimeout(function() {
			i.setData({
				areas: t.getCache('cacheset').areas
			});
		}, 3e3);
	},
	onShow: function() {
		this.setData({
			isgoods: t.globalData.isgoods
		});
		var e = this;
		t.getCache('isIpx')
			? e.setData({
					isIpx: !0,
					iphonexnavbar: 'fui-iphonex-navbar'
			  })
			: e.setData({
					isIpx: !1,
					iphonexnavbar: ''
			  }),
			uni.getStorage({
				key: 'mydata',
				success: function(t) {
					uni.removeStorage({
						key: 'mydata',
						success: function(t) {}
					}),
						e.getDetail(t),
						uni.pageScrollTo({
							scrollTop: 0
						});
				}
			});
		// #ifdef APP-PLUS
		uni.getSetting({
			success: function(t) {
				var a = t.authSetting['scope.userInfo'];
				e.setData({
					limits: a
				});
			}
		});
		// #endif
	},
	onShareAppMessage: function() {
		return (
			this.setData({
				closeBtn: !1
			}),
			e.onShareAppMessage('/pages/goods/detail/index?id=' + this.options.id, this.goods.title)
		);
	},
	onHide: function() {
		this.setData({
			closeBtn: !1
		});
	},
	onHide: function() {
		this.pauseOther();
	},
	onReady: function(res) {
		this.videoContext = uni.createVideoContext('myVideo');
	},
	onUnload: function() {
		this.pauseOther();
	},
	methods: {
		imageLoad: function(t) {
			var e = t.detail.height,
				a = t.detail.width,
				o = Math.floor((750 * e) / a);
			e == a
				? this.setData({
						advHeight: 750
				  })
				: this.setData({
						advHeight: o
				  });
		},
		favorite: function(a) {
			t.checkAuth();
			var o = this;

			if (o.limits) {
				var i = a.currentTarget.dataset.isfavorite == 0 ? 1 : 0;
				console.log(i, a.currentTarget.dataset.isfavorite, a.currentTarget.dataset.isfavorite == 0, a.currentTarget.dataset.isfavorite == '0');
				e.get(
					'member/favorite/toggle',
					{
						id: o.options.id,
						isfavorite: i
					},
					function(t) {
						t.isfavorite
							? o.setData({
									'goods.isfavorite': 1
							  })
							: o.setData({
									'goods.isfavorite': 0
							  });
					}
				);
			}
		},
		goodsTab: function(t) {
			var a = this,
				o = t.currentTarget.dataset.tap;
			if ('info' == o)
				this.setData({
					info: 'active',
					para: '',
					comment: ''
				});
			else if ('para' == o)
				this.setData({
					info: '',
					para: 'active',
					comment: ''
				});
			else if ('comment' == o) {
				if (
					(a.setData({
						info: '',
						para: '',
						comment: 'active'
					}),
					a.commentList.length > 0)
				)
					return void a.setData({
						loading: !1
					});
				a.setData({
					loading: !0
				}),
					e.get(
						'goods/get_comment_list',
						{
							id: a.options.id,
							level: a.commentLevel,
							page: a.commentPage
						},
						function(t) {
							t.list.length > 0
								? a.setData({
										loading: !1,
										commentList: t.list,
										commentTotal: t.total,
										commentPage: t.page
								  })
								: a.setData({
										loading: !1,
										commentEmpty: !0
								  });
						}
					);
			}
		},
		comentTap: function(t) {
			var a = this,
				o = t.currentTarget.dataset.type,
				i = '';
			1 == o
				? ((i = 'all'), (a.commentPage = 1))
				: 2 == o
				? ((a.commentPage = 1), (i = 'good'))
				: 3 == o
				? ((a.commentPage = 1), (i = 'normal'))
				: 4 == o
				? ((a.commentPage = 1), (i = 'bad'))
				: 5 == o && ((a.commentPage = 1), (i = 'pic')),
				o != a.commentObjTab &&
					e.get(
						'goods/get_comment_list',
						{
							id: a.options.id,
							level: i,
							page: a.commentPage
						},
						function(t) {
							t.list.length > 0 &&
								a.setData({
									loading: !1,
									commentList: t.list,
									commentTotal: t.total,
									commentPage: t.page,
									commentObjTab: o,
									commentEmpty: !1
								});
						}
					);
		},
		preview: function(t) {
			uni.previewImage({
				current: t.currentTarget.dataset.src,
				urls: t.currentTarget.dataset.urls
			});
		},
		getDetail: function(t) {
			var o = this,
				i = parseInt(Date.now() / 1e3);
			o.setData({
				loading: !0
			}),
				e.get(
					'goods/get_detail',
					{
						id: t.id
					},
					function(t) {
						if (0 != t.error)
							return (
								o.setData({
									show: !0,
									showgoods: !1
								}),
								a.toast(o, t.message),
								void setTimeout(function() {
									uni.navigateBack();
								}, 1500)
							);
						['marketprice', 'productprice'].forEach(function(e) {
							void 0 !== t.goods[e] && (t.goods[e] = parseFloat(t.goods[e]));
						});

						var s = t.goods.coupons,
							d = t.goods.thumbMaxHeight,
							l = (t.goods.thumbMaxWidth, t.goods.goodscircle);
							if(s.length>0){
								var min=[];
								//计算最低优惠卷
								Object.keys(s).map((item)=>{
									let price=0
									if(s[item].backtype==1){
										price=t.goods.productprice*(s[item].backmoney)/10
									}	
									if(s[item].backtype==0){
										if(t.goods.productprice>=s[item].enough){
											price=t.goods.productprice-s[item].deduct
										}
										
									}
									console.log(price)
									if(price>0)
										min.push(price)

								})
								o.couponPrice=Math.min.apply(null, min)	
							}
							
						if (
							(o.setData({
								coupon: s,
								coupon_l: s.length,
								packagegoods: t.goods.packagegoods,
								packagegoodsid: t.goods.packagegoods.goodsid || 0,
								credittext: t.goods.credittext,
								activity: t.goods.activity,
								bottomFixedImageUrls: t.goods.bottomFixedImageUrls,
								phonenumber: t.goods.phonenumber || '',
								showDate: t.goods.showDate || '',
								scope: t.goods.scope || '',
								show_goods: t.goods.show_goods,
								goodscircle: l
							}),
							t.goods.packagegoods && o.packageFun(),
							r.wxParse('wxParseData', 'html', t.goods.content, o, '0'),
							r.wxParse('wxParseData_buycontent', 'html', t.goods.buycontent, o, '0'),
							o.setData({
								show: !0,
								goods: t.goods,
								minprice: t.goods.minprice,
								maxprice: t.goods.maxprice,
								preselltimeend: t.goods.preselltimeend,
								style: t.goods.labelstyle.style || '',
								navbar: t.goods.navbar,
								labels: t.goods.labels
							}),
							t.goods.gifts &&
								1 == t.goods.gifts.length &&
								o.setData({
									giftid: t.goods.gifts[0].id
								}),
							uni.setNavigationBarTitle({
								title: t.goods.title || '商品详情'
							}),
							(c = t.goods.hasoption),
							n.isEmptyObject(t.goods.dispatchprice) || 'string' == typeof t.goods.dispatchprice
								? o.setData({
										dispatchpriceObj: 0
								  })
								: o.setData({
										dispatchpriceObj: 1
								  }),
							t.goods.isdiscount > 0 && t.goods.isdiscount_time >= i)
						) {
							clearInterval(o.timer);
							var u = setInterval(function() {
								o.countDown(0, t.goods.isdiscount_time);
							}, 1e3);
							o.setData({
								timer: u
							});
						} else
							o.setData({
								discountTitle: '活动已结束'
							});

						if (t.goods.istime > 0) {
							clearInterval(o.timer);
							u = setInterval(function() {
								o.countDown(t.goods.timestart, t.goods.timeend, 'istime');
							}, 1e3);
							o.setData({
								timer: u
							});
						}

						if (t.goods.ispresell > 0) {
							u = setInterval(function() {
								0 == t.goods.canbuy ? o.countDown(i, t.goods.preselltimestart, 'istime') : 1 == t.goods.canbuy && o.countDown(i, t.goods.preselltimeend, 'istime');
							}, 1e3);
							o.setData({
								timer: u,
								presellisstart: t.goods.presellisstart
							}),
								o.setData({
									preselltimeend:
										t.goods.preselltimeend ||
										t.goods.preselltimeend.getMonth() + '月' + t.goods.preselltimeend ||
										t.goods.preselltimeend.getDate() + '日 ' + t.goods.preselltimeend ||
										t.goods.preselltimeend.getHours() + ':' + t.goods.preselltimeend ||
										t.goods.preselltimeend.getMinutes() + ':' + t.goods.preselltimeend ||
										t.goods.preselltimeend.getSeconds(),
									presellsendstatrttime:
										t.goods.presellsendstatrttime ||
										t.goods.presellsendstatrttime.getMonth() + '月' + t.goods.presellsendstatrttime ||
										t.goods.presellsendstatrttime.getDate() + '日'
								});
						}

						t.goods.getComments > 0 &&
							e.get(
								'goods/get_comments',
								{
									id: o.options.id
								},
								function(t) {
									o.setData({
										commentObj: t
									});
								}
							),
							t.goods.fullbackgoods &&
								o.setData({
									fullbackgoods: t.goods.fullbackgoods
								});
						var g = o.fullbackgoods;

						if (null != g) {
							var m = g.maxfullbackratio,
								h = g.maxallfullbackallratio;
							(m = Math.round(m)), (h = Math.round(h));
							o.setData({
								maxfullbackratio: m,
								maxallfullbackallratio: h
							});
						}

						9 == t.goods.type &&
							(o.setData({
								checkedDate: t.goods.nowDate
							}),
							o.show_cycelbuydate()),
							t.goods.seckillinfo && o.initSeckill(t.goods);
					}
				);
		},
		initSeckill: function(e) {
			var a = this,
				o = parseInt(e.seckillinfo.status),
				i = e.seckillinfo.starttime,
				s = e.seckillinfo.endtime;

			if (-1 != o) {
				var n = 0,
					r = 0,
					c = t.globalData.approot;
				uni.request({
					url: c + 'map.json',
					success: function(t) {
						var c = new Date(t.header.Date) / 1e3;
						(n = 0 == o ? s - c : i - c),
							a.setData({
								lasttime: n
							}),
							clearInterval(a.timer),
							a.setTimer(e.seckillinfo),
							(r = a.setTimerInterval(e.seckillinfo)),
							a.setData({
								timer: r
							});
					}
				});
			}
		},
		setTimer: function(e) {
			var a = this,
				o = 0;

			if (-1 != e.status && parseInt(a.lasttime) % 10 == 0) {
				var i = parseInt(e.status),
					s = e.starttime,
					n = e.endtime;

				if (-1 != i) {
					var r = t.globalData.approot;
					uni.request({
						url: r + 'map.json',
						success: function(t) {
							var e = new Date(t.header.Date) / 1e3;
							(o = 0 == i ? n - e : s - e),
								a.setData({
									lasttime: o
								});
						}
					});
				}
			}

			o = parseInt(a.lasttime) - 1;
			var c = a.formatSeconds(o);
			a.setData({
				lasttime: o,
				hour: c.hour,
				min: c.min,
				sec: c.sec
			}),
				o <= 0 && a.onLoad();
		},
		setTimerInterval: function(t) {
			var e = this;
			return setInterval(function() {
				e.setTimer(t);
			}, 1e3);
		},
		formatSeconds: function(t) {
			var e = parseInt(t),
				a = 0,
				o = 0;
			return (
				e > 60 && ((a = parseInt(e / 60)), (e = parseInt(e % 60)), a > 60 && ((o = parseInt(a / 60)), (a = parseInt(a % 60)))),
				{
					hour: o < 10 ? '0' + o : o,
					min: a < 10 ? '0' + a : a,
					sec: e < 10 ? '0' + e : e
				}
			);
		},
		countDown: function(t, e, a) {
			var o = parseInt(Date.now() / 1e3),
				i = parseInt((t > o ? t : e) - o),
				s = Math.floor(i / 86400),
				n = Math.floor((i - 24 * s * 60 * 60) / 3600),
				r = Math.floor((i - 24 * s * 60 * 60 - 3600 * n) / 60),
				c = [s, n, r, Math.floor(i - 24 * s * 60 * 60 - 3600 * n - 60 * r)];

			if (
				(this.setData({
					time: c
				}),
				'istime')
			) {
				var d = '';
				t > o
					? (d = '距离限时购开始')
					: t <= o && e > o
					? (d = '距离限时购结束')
					: ((d = '活动已经结束，下次早点来~'),
					  this.setData({
							istime: 0
					  })),
					this.setData({
						istimeTitle: d
					});
			}
		},
		cityPicker: function(t) {
			t.currentTarget.dataset.tap;
			uni.navigateTo({
				url: '/pages/goods/region/index?id=' + this.goods.id + '&region=' + this.goods.citys.citys + '&onlysent=' + this.goods.citys.onlysent
			});
		},
		giftPicker: function() {
			this.setData({
				active: 'active',
				gift: !0
			});
		},
		couponPicker: function() {
			this.setData({
				active: 'active',
				showcoupon: !0
			});
		},
		couponrecived: function(t) {
			console.log(t);
			var o = t.currentTarget.dataset.id,
				i = this;
			e.post(
				'goods.pay_coupon',
				{
					id: o
				},
				function(t) {
					0 == t.error
						? (i.setData({
								showcoupon: !1,
								active: ''
						  }),
						  a.toast(i, '已领取'))
						: a.toast(i, t.message);
				}
			);
		},
		selectPicker: function(e) {
			t.checkAuth();
			var a = e.currentTarget.dataset.time,
				o = e.currentTarget.dataset.timeout;
			if (this.limits) {
				if ('timeout' == a || 'access_time' == a) {
					if ('false' == o)
						return void this.setData({
							goods_hint_show: !0
						});
					if ('true' == o) {
						if ('access_time' == a) {
							this.setData({
								goods_hint_show: !1
							});
							var i = 'goodsdetail';
							return void s.selectpicker(e, this, i);
						}
						if ('timeout' == a)
							return void this.setData({
								goods_hint_show: !1
							});
					}
				}

				i = 'goodsdetail';
				s.selectpicker(e, this, i);
				//调用子组件方法
				this.$refs.child.show('select-picker', this, e.currentTarget.dataset.buytype);
			}
		},
		//隐藏
		selecthide: function() {
			//子组件调用方法
			this.active = '';
			this.showPicker = !1;
		},
		specsTap: function(t) {
			s.specsTap(t, this);
			console.log(this);
		},
		emptyActive: function() {
			this.setData({
				active: '',
				slider: 'out',
				tempname: '',
				showcoupon: !1,
				gift: !1,
				cycledate: !1
			});
			//调用父组件方法
			this.$refs.child.show('');
		},
		buyNow: function(t) {
			console.log('goods_detail');
			s.buyNow(t, this, 'goods_detail');
		},
		getCart: function(t) {
			s.getCart(t, this);
		},
		select: function() {
			var t = this.optionid;
			this.diyform;
			c > 0 && 0 == t
				? a.toast(this, '请选择规格')
				: this.setData({
						active: '',
						slider: 'out',
						isSelected: !0,
						tempname: ''
				  });
		},
		inputNumber: function(t) {
			s.inputNumber(t, this);
		},
		number: function(t) {
			s.number(t, this);
		},
		show_cycelbuydate: function() {
			var t = d.getCurrentDayString(this, this.showDate);
			this.setData({
				currentObj: t,
				currentDate: t.getFullYear() + '年' + (t.getMonth() + 1) + '月' + t.getDate() + '日 ' + ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][t.getDay()],
				currentYear: t.getFullYear(),
				currentMonth: t.getMonth() + 1,
				currentDay: t.getDate(),
				initDate: Date.parse(t.getFullYear() + '/' + (t.getMonth() + 1) + '/' + t.getDate()),
				checkedDate: Date.parse(t.getFullYear() + '/' + (t.getMonth() + 1) + '/' + t.getDate()),
				maxday: this.scope
			});
		},
		packageFun: function() {
			var t = this;
			e.get(
				'package.get_list',
				{
					goodsid: this.packagegoodsid
				},
				function(e) {
					t.setData({
						packageList: e.list[0]
					});
				}
			);
		},

		showpicFun() {
			this.showpic=1
			this.cover=0
			this.showvideo=0
			//this.videoContext.stop()
			console.log(this.videoContext)
			//this.videoContext.pause()
		},
		showvideoFun() {
			this.showpic=0
			this.showvideo=1
			this.videoContext.stop()
			this.videoContext.play()
			console.log(this.videoContext)
			
		},
		startplay: function() {
			this.setData({
				cover: !1
			}),
				(this.videoContext = uni.createVideoContext('myVideo')),
				this.videoContext.play();
		},
		bindfullscreenchange: function(t) {
			1 == t.detail.fullScreen
				? this.setData({
						success: !1
				  })
				: this.setData({
						success: !0
				  });
		},
		phone: function() {
			var t = this.phonenumber + '';
			uni.makePhoneCall({
				phoneNumber: t
			});
		},
		sharePoster: function() {
			uni.navigateTo({
				url: '/pages/goods/poster/poster?id=' + this.uid
			});
		},
		closeBtnFun: function() {
			this.setData({
				closeBtn: !1
			});
		},
		showshade: function() {
			t.checkAuth(),
				this.setData({
					closeBtn: !0
				});
		},
		navFun: function() {
			this.setData({
				nav_mask: !this.nav_mask
			});
		},
		nav2: function() {
			this.setData({
				nav_mask2: !this.nav_mask2
			});
		},
		changevoice: function() {
			this.sound
				? this.setData({
						sound: !1,
						soundpic: !0
				  })
				: this.setData({
						sound: !0,
						soundpic: !1
				  });
		},
		radioChange: function(t) {
			this.setData({
				giftid: t.currentTarget.dataset.giftgoodsid,
				gift_title: t.currentTarget.dataset.title
			});
		},
		activityPicker: function() {
			this.setData({
				fadein: 'in'
			});
		},
		actOutPicker: function() {
			console.log('actOutPicker');
			this.setData({
				fadein: ''
			});
		},
		hintclick: function() {
			uni.openSetting({
				success: function(t) {}
			});
		},
		cancelclick: function() {
			this.setData({
				modelShow: !1
			});
		},
		confirmclick: function() {
			this.setData({
				modelShow: !1
			}),
				uni.openSetting({
					success: function(t) {}
				});
		},
		sendclick: function() {
			uni.navigateTo({
				url: '/pages/map/index'
			});
		},
		syclecancle: function() {
			this.setData({
				cycledate: !1
			});
		},
		sycleconfirm: function() {
			this.setData({
				cycledate: !1
			});
		},
		editdate: function(t) {
			d.setSchedule(this),
				this.setData({
					cycledate: !0
				});
		},
		bindChange: function(t) {
			return i.bindChange(this, t);
		},
		onCancel: function(t) {
			return i.onCancel(this, t);
		},
		onConfirm: function(t) {
			return i.onConfirm(this, t);
		},
		doDay: function(t) {
			d.doDay(t, this);
		},
		selectDay: function(t) {
			d.selectDay(t, this), d.setSchedule(this);
		},
		playFun: function(t) {
			var e = t.currentTarget.dataset.id,
				a = this.audiosObj[e] || !1;

			if (!a) {
				a = uni.createInnerAudioContext('audio_' + e);
				var o = this.audiosObj;
				(o[e] = a),
					this.setData({
						audiosObj: o
					});
			}

			var i = this;
			a.onPlay(function() {
				var t = setInterval(function() {
					var o = (a.currentTime / a.duration) * 100 + '%',
						s = Math.floor(Math.ceil(a.currentTime) / 60),
						n = ((Math.ceil(a.currentTime) % 60) / 100).toFixed(2).slice(-2),
						r = Math.ceil(a.currentTime);
					s < 10 && (s = '0' + s);
					var c = s + ':' + n,
						d = i.audios;
					(d[e].audiowidth = o),
						(d[e].Time = t),
						(d[e].audiotime = c),
						(d[e].seconds = r),
						i.setData({
							audios: d
						});
				}, 1e3);
			});
			var s = t.currentTarget.dataset.audio,
				n = t.currentTarget.dataset.time,
				r = t.currentTarget.dataset.pausestop,
				c = t.currentTarget.dataset.loopplay;
			0 == c &&
				a.onEnded(function(t) {
					(d[e].status = !1),
						i.setData({
							audios: d
						});
				});
			var d = i.audios;
			d[e] || (d[e] = {}),
				a.paused && 0 == n
					? ((a.src = s), a.playFun(), 1 == c && (a.loop = !0), (d[e].status = !0), i.pauseOther(e))
					: a.paused && n > 0
					? (a.playFun(), 0 == r ? a.seek(n) : a.seek(0), (d[e].status = !0), i.pauseOther(e))
					: (a.pause(), (d[e].status = !1)),
				i.setData({
					audios: d
				});
		},
		pauseOther: function(t) {
			var e = this;
			n.each(this.audiosObj, function(a, o) {
				if (a != t) {
					o.pause();
					var i = e.audios;
					i[a] &&
						((i[a].status = !1),
						e.setData({
							audios: i
						}));
				}
			});
		},
		navigate: function(t) {
			var e = t.currentTarget.dataset.url,
				a = t.currentTarget.dataset.phone,
				o = t.currentTarget.dataset.appid,
				i = t.currentTarget.dataset.appurl;
			e &&
				uni.navigateTo({
					url: e,
					fail: function() {
						uni.switchTab({
							url: e
						});
					}
				}),
				a &&
					uni.makePhoneCall({
						phoneNumber: a
					}),
				o &&
					uni.navigateToMiniProgram({
						appId: o,
						path: i
					});
		},
		close: function() {
			(t.globalData.flag = !0),
				uni.reLaunch({
					url: '../index/index'
				});
		},

		bindTextAreaBlur: function(t) {
			var e = t.detail.value,
				a = t.currentTarget.dataset.index;
			(this.diyform.fields[a].texthide = !1),
				(this.diyform.fields[a].textareashow = !1),
				(this.diyform.fields[a].placeholder = e),
				(this.diyform.fields[a].black = 'color: #000'),
				this.setData({
					diyform: this.diyform
				});
		},
		setData: function(obj) {
			let that = this;
			let keys = [];
			let val, data;
			Object.keys(obj).forEach(function(key) {
				keys = key.split('.');
				val = obj[key];
				data = that.$data;
				keys.forEach(function(key2, index) {
					if (index + 1 == keys.length) {
						that.$set(data, key2, val);
					} else {
						if (!data[key2]) {
							that.$set(data, key2, {});
						}
					}
					data = data[key2];
				});
			});
		}
	}
};
</script>
<style>
@import './index.css';
.jh{
	margin-left: 10upx ;
	background-color: #e6c684;
	color: #FFFFFF;
	padding: 10upx ;
	border-radius:20upx ;
	font-size: 22upx ;
}
</style>
